package cn.wolfcode.wms.web.controller;


import cn.wolfcode.wms.domain.Employee;
import cn.wolfcode.wms.service.EmployeeService;
import cn.wolfcode.wms.vo.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller

public class LoginController {
    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/login.do")
    @ResponseBody
    public JSONResult login(Employee employee){
        try {

            employeeService.login(employee);
        }catch (Exception e){
            e.printStackTrace();
            return JSONResult.mark(e.getMessage());
        }
        return  JSONResult.success("登陆成功");

    }

    @RequestMapping("/main.do")
    public String main(){
        return "main";
    }

}
